<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆</title>
    <link rel="stylesheet" href="/Album/Public/css/bootstrap.min.css"/>
    <script src="/Album/Public/js/jquery.js"></script>
    <script src="/Album/Public/js/bootstrap.min.js"></script>
    <style>
        .out{border:1px solid red;color:red;}
    </style>
</head>
<body>
<div class="panel panel-primary col-xs-12 col-sm-6 col-sm-offset-3 col-md-6 col-md-offset-3" style="padding:0;display: none;">
    <div class="panel-heading">
       <span style="font-size:large;display: block;margin-left:45%;">登陆</span>
    </div>
    <div class="panel-body">
        <form onsubmit="return false">
            <div class="form-group"  >
                <label for="exampleInputEmail1">用户名</label>
                <input type="text" class="form-control" id="exampleInputEmail1" placeholder="请输入用户名">
            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">密码</label>
                <input type="password" class="form-control" id="exampleInputPassword1" placeholder="请输入密码" >
            </div>
            <button class="btn btn-default" data-toggle="modal fade" data-target="#myModal">登陆</button>
        </form>
    </div>
    <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Modal title</h4>
                </div>
                <div class="modal-body">
                    账号为空！！！
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="close" >确定</button>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Modal title</h4>
                </div>
                <div class="modal-body">
                    密码为空！！！
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="close1">确定</button>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(function(){
            $('.panel-heading').parent().show(1000);
        })

        $('button').click(function(){
            var list=[];
            $(':input').each(function(){
               list.push($.trim($(this).val()));
            })
            if(list[0]==''){
                $('#myModal1').modal('show');
                return false;
            }
            if(list[1]==''){
                $('#myModal2').modal('show');
                return false;
            }
            $.ajax({
                url:"<?php echo U('Login/dologin');?>",
                type:'POST',
                data:{'name':list[0],'pwd':list[1]},
                dataType:'json',
                success:function(data){
                    if(data){
                        window.location.href="<?php echo U('Index/index');?>";
                    }else{
                        window.location.href="";
                    }
                },
            })
        })
        $('#close').click(function(){
            $('#myModal1').modal('hide');
        })
        $('#close1').click(function(){
            $('#myModal2').modal('hide');
        })
        $('.close').click(function(){
            $('#myModal1').modal('hide');
        })
        $('.close').click(function(){
            $('#myModal2').modal('hide');
        })
    </script>
</div>
</body>
</html>